package com.abbas.wallerpaper.base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.google.android.material.snackbar.Snackbar;

public abstract class BaseFragment extends Fragment {

    protected View rootView;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        rootView = inflater.inflate(getLayoutId(),container,false);

        init();
        initEvent();
        initData();

        return rootView;
    }

    protected abstract int getLayoutId();

    protected abstract void init();

    protected abstract void initEvent();

    protected abstract void initData();

    protected void showTip(View view, String tip) {
        Snackbar.make(view, tip, Snackbar.LENGTH_SHORT).show();
    }
}
